package com.twu.biblioteca.models;

/**
 * Created with IntelliJ IDEA.
 * User: mmoise
 * Date: 14/05/2013
 * Time: 09:31
 * To change this template use File | Settings | File Templates.
 */
public class Book {
    private String title;
    private String author;
    private String code;
    private boolean reserved;

    public Book(String title, String author, String code){
        this.title = title;
        this.author = author;
        this.code = code;
        this.reserved = false;
    }


    public String getCode(){
        return code;
    }

    public boolean isReserved(){
        return reserved;
    }

    public void reserve(){
        reserved = true;
    }

    @Override
    public String toString(){
        return title + " - " + author + " | code:" + code;
    }

    @Override
    public boolean equals (Object book){
        return title.equals(((Book)book).title) && author.equals(((Book)book).author) && code.equals(((Book)book).code);
    }
}
